package com.njmaomao.gj.pyot.domain.wechat;

import com.njmaomao.gj.pyot.domain.model.PayRecord;
import com.njmaomao.gj.pyot.service.domain.PaymentOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class OrderFactory {

    @Autowired
    private PaymentOrderService paymentOrderService;

    public PaymentOrder getOrder(String orderCode, Integer orderType, Long customerId, Integer txnAmt, String orderDesc) {
        PaymentOrder order = null;
        switch (PayRecord.OrderType.get(orderType)) {
            case ORDER:
                order = paymentOrderService.getOrder(orderCode, customerId);
                break;
            case APPDEFINED:
                order = paymentOrderService.getOrder(orderCode, customerId);
                break;
            case Errand:
                order = paymentOrderService.getOrder(orderCode, customerId);
                break;
            default:
                order = paymentOrderService.getOrder(orderCode, customerId);
                break;
        }
        return order;
    }

    private PaymentOrder getAppDefinedOrder(String orderCode, Long customerId, Integer txnAmt, String orderDesc) {
        return new AppDefinedOrder(orderCode, txnAmt, orderDesc, 2, 1, 1);
    }

}
